package icu.lyt0628;

import java.io.PrintStream;
import java.util.Scanner;

public class ToggleDir {
    public static void main(String[] args) {
        App app = new App();
        app.connect();

        Scanner scan = new Scanner(System.in);
        PrintStream o = System.out;

        o.println("Please input src file path:  ");
        String dir = scan.nextLine();


        if (!app.exists(dir)){
            app.mkdir(dir);
            o.println("dir created");
        }else {
           if (app.isEmpty(dir)){
               app.rmDir(dir);
               o.println("dir removed");
           }else {
               while (true){
                   o.println("dir is not empty, continue?(yes/no)");
                   String s = scan.nextLine();
                   if (s.contains("yes")){
                       app.rmDir(dir);
                       o.println("dir removed");
                       break;
                   }else if (s.contains("no")){
                        break;
                   }else {
                       o.println("prease input yes or no");
                   }
               }
           }
        }

        app.release();
    }
}
